/***
 * 通过new socket类实例创建net服务器
 */

var net = require('net');
var socket = new net.Socket();

socket.connect(8124,"192.168.3.31",function(){
    console.log("连接上一个客户端")
    //var socket = new net.Socket();
    socket.write("客户端发出数据");
    //
     
})
socket.on('data',function(data){
    console.log(data.toString());
    socket.end();
}) 
socket.on('end',function(){
        console.log("断开连接1")
})

socket.on('close',function(){
    console.log("断开连接2")
})